/*
	Answer to Exercise 2-8, page 49
	Write a function rightrot(x,n) that returns the value of the integer x rotated to the right by n bit positions. 
*/

int main(){
	
	return 0;
}

int rightrot(int x, int n){
	while (n > 0) {
        if ((x & 1) == 1)
            x = (x >> 1) | ~(~0U >> 1);
        else
            x = (x >> 1);
        n--;
    }
    return x;
}